﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JavascriptEngine
{
    public static class JSUtils
    {
        public static object WriteLine_0()
        {
            Console.WriteLine();
            return "";
        }
        public static object WriteLine_1(object obj)
        {
            return WriteLine(new[] { obj });
        }
        public static object WriteLine_2(object obj1, object obj2)
        {
            return WriteLine(new[] { obj1, obj2 });
        }
        public static object WriteLine_3(object obj1, object obj2, object obj3)
        {
            return WriteLine(new[] { obj1, obj2, obj3 });
        }
        public static object WriteLine_4(object obj1, object obj2, object obj3, object obj4)
        {
            return WriteLine(new[] { obj1, obj2, obj3, obj4 });
        }
        private static object WriteLine(object[] nodes)
        {
            string last = "";
            foreach (object node in nodes)
            {
                if (node == null)
                    last = "null";
                else
                    last = node.ToString();
                Console.Write(last + " ");
            }
            Console.WriteLine();

            return last;
        }
    }
}
